package com.wangx1n;

import com.wangx1n.bean.MyBean;
import com.wangx1n.bean.Person;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author WangXin
 * @date 2020/12/3 14:04
 */
public class MyTest {
//    工厂bean
    @Test
    public void FactoryBeanTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
//        返回类型已经不是在xml文件中定义的东西了
        Person myBean = context.getBean("myBean", Person.class);
        System.out.println(myBean);
        System.out.println(myBean.getName());
    }
}
